package com.aspose.cells;

class zqr {
   private zauk g;
   Worksheet a;
   Range b;
   Range c;
   String d;
   boolean e;
   String f;

   zqr(zauk var1, Worksheet var2, String var3) {
      this.g = var1;
      this.a = var2;
      this.d = var3;
   }

   String a() {
      if (this.b != null && this.b.getName() == null && this.a != null) {
         return zavb.a(this.b.a(), this.a.getName());
      } else {
         return this.a != null && this.d.indexOf("!") == -1 ? this.a.getName() + "!" + this.d : this.d;
      }
   }

   int b() {
      String var1 = null;
      int var2 = 0;
      boolean var3;
      if (this.b == null) {
         if (this.d == null) {
            return 0;
         }

         var3 = zakq.f(this.d);
         var2 += 4 + (var3 ? this.d.length() + 1 : this.d.length() * 2 + 2);
      }

      if (this.a != null && this.b != null) {
         var1 = this.a.getName();
         var1 = zbqg.a(var1, 0);
         var3 = zakq.f(var1);
         var2 += 4 + (var3 ? var1.length() + 1 : var1.length() * 2 + 2);
      } else if (this.d == null || this.b != null && this.b.getName() != null) {
         var2 += 2;
      }

      if (this.b != null && this.b.getName() != null) {
         var2 += 6 + zakq.e(this.b.getName());
      } else {
         var2 += 10;
      }

      return var2;
   }

   int a(byte[] var1, int var2) {
      int var3 = var2;
      if (this.b == null) {
         if (this.d != null) {
            var2 += this.b(var1, var2);
            return var2 - var3;
         } else {
            return 0;
         }
      } else {
         if (this.b.getName() != null) {
            var2 += this.c(var1, var2);
         } else {
            var2 += this.b(var1, var2);
         }

         return var2 - var3;
      }
   }

   int b(byte[] var1, int var2) {
      int var3 = var2;
      var1[var2] = 81;
      var1[var2 + 1] = 0;
      var2 += 4;
      if (this.b != null) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.b.getFirstRow()), 0, var1, var2, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.b.getFirstRow() + this.b.getRowCount() - 1), 0, var1, var2 + 2, 2);
         var1[var2 + 4] = (byte)this.b.getFirstColumn();
         var1[var2 + 5] = (byte)(this.b.getFirstColumn() + this.b.getColumnCount() - 1);
      }

      var2 += 6;
      if (this.a != null) {
         var2 += zco.a(var1, var2, this.a.getName(), 2, (byte)2);
      } else {
         String var4 = this.d;
         var4 = zbqg.a(var4, 0);
         var4 = var4.substring(1);
         var2 += zco.a(var1, var2, var4, 2, (byte)2);
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a((short)(var2 - var3 - 4)), 0, var1, var3 + 2, 2);
      return var2 - var3;
   }

   int c(byte[] var1, int var2) {
      int var3 = var2;
      var1[var2] = 82;
      var1[var2 + 1] = 0;
      var2 += 4;
      var1[var2++] = (byte)this.b.getName().length();
      ++var2;
      byte[] var4 = zakq.a(this.b.getName());
      if (var4 != null) {
         var1[var2++] = (byte)(var4.length == this.b.getName().length() ? 0 : 1);
         System.arraycopy(var4, 0, var1, var2, var4.length);
         var2 += var4.length;
      } else {
         var1[var2++] = 0;
      }

      if (this.a != null) {
         var2 += zco.a(var1, var2, this.a.getName(), 2, (byte)2);
      } else {
         var1[var2++] = 0;
         var1[var2++] = 0;
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a((short)(var2 - var3 - 4)), 0, var1, var3 + 2, 2);
      return var2 - var3;
   }
}
